var toTop = document.querySelector("#toTop");
//    滚动条事件，滚动触发一次，这个事件执行一次
window.onscroll = function(){
    console.log(document.documentElement.scrollTop || document.body.scrollTop);
//        判断它距离顶部的位置
    if(document.documentElement.scrollTop > 1000 || document.body.scrollTop > 1000){
        toTop.style.display = "block";
    }else{
        toTop.style.display = "none";
    }
};

toTop.addEventListener('click', function (){
//        滚动到指定的位置
    window.scrollTo(0,0);
//        widow.scrollTo({
//            top:0,
//            behavior:'smooth'
//        });
});



var dt_nav_btn = document.querySelector("#dt-nav-btn");
var dt_nav_content = document.querySelector("#dt-nav-content");

//移入分类按钮
dt_nav_btn.addEventListener("mouseover",function(){
    //移入的时候，执行显示分类详情
    dt_nav_content.style.display ="block";
});
dt_nav_btn.addEventListener("mouseleave",function(){
    dt_nav_content.style.display ="none";
});
//移入详情
dt_nav_content.addEventListener("mouseover",function(){
    dt_nav_content.style.display ="block";
});
//移出详情
dt_nav_content.addEventListener("mouseleave",function(){
    dt_nav_content.style.display="none";
});


function  zan(){
    var num = document.querySelector("#zan1").innerHTML;
    num = Number(num);
    console.log(num);
    document.querySelector("#zan1").innerHTML =num+1;
}
function  zan2(){
    var num = document.querySelector("#zan2").innerHTML;
    num = Number(num);
    console.log(num);
    document.querySelector("#zan2").innerHTML =num+1;
}